<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="../include/taglib.jsp"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>联盟管理-评价</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<%@ include file="../include/jsCss.jsp"%>
  </head>
  
  <body>
    	<form action="" method="post">
			<table border="1" width="110%">
				<tr>
					<th colspan="13"><h2>联盟管理 - 评价信息</h2>
				</th>
				</tr>
				<tr>
					<td style="border:0px;" colspan="2">评价人：
					<input type="text" name=""/>
					<input type="submit" value="搜索" /></td>
					<td  colspan="10" style="border:0px;text-align:right;padding-right:20px;">
					 	<!--  <a href="menu!menuAdd.html">添加菜单信息</a>-->
					 	<input type="button" value="作废" onclick="auditUser(1,1)"/>
					 	<input type="button" value="取消作废" onclick="auditUser(0,2)"/>
					</td>
				</tr>
				<tr> 
					<td><input type="checkbox" onclick="checkedAll(this)"></td>
					<td>ID</td>
					<td>评价内容</td>
					<td>评分</td>
					<td>评价人</td>
					<td>评价类型</td>
					<td>评价是否成功</td>
					<td>评价时间</td> 
					
				</tr>
				
				<s:iterator value="appraisalList" status="status">
					<tr> 
						<td><input type="checkbox" name="userCheck" value="${id}"/></td>
						<td>
							<s:property value="#status.index+1"/>
						</td>
						<td><s:property value="appraisalInfo" />
						</td>
						<td><s:property value="score" />
						</td>
						<td><s:property value="appUserName" />
						</td>
						<td>
							<s:if test="status==1">
								作废
							</s:if>
							<s:elseif test="status==0">
								评价成功
							</s:elseif>
						</td>
						<td>
							<s:if test="appraisalType==1">
								对餐厅评价
							</s:if>
							<s:elseif test="appraisalType==2">
								对菜肴评价
							</s:elseif>
							<s:elseif test="appraisalType==3">
								优惠评价
							</s:elseif>
						</td>
						<td><s:property value="createDate" />
						</td> 
						
					</tr>
				</s:iterator>
			</table>
			<div>
				<jsp:include page="../include/page.jsp"></jsp:include> 
			</div>
	</form>
  </body>
</html>
<script type="text/javascript">
	//联盟管理员审核功能
	function auditUser(status,type) {
		var userIds = "";
		var checkBool = true;
		$("input[name='userCheck']").each(function(i,item){
			 if (item.checked == true && checkBool == true) {
				 userIds += item.value + ",";
			 }
		});
		
		if (!checkBool) {
			alert("只能审核会员信息!");
			return;
		}
		if (userIds == "") {
			alert("请选择要审核的会员!");
			return;
		}
		
		userIds = userIds.substring(0, userIds.length-1);
		var dt = new Date();
		$.ajax( {
			type : "POST",
			url : "appraisal/appraisal!updateUserStatus.html",
			data : "userIds="+userIds+"&status="+status+"&date=" + dt,
			success : function(data) {
				if ($.trim(data) == 0) {
					if (type == 1) { 
						alert('作废成功!');
					}
					if (type == 2) {
						alert('取消作废成功');
					}
					document.location.reload();
				}
			}
		}); 
	}
	
	function checkedAll(t) { 
		$("input[name='userCheck']").each(function(i,item){
			 item.checked = t.checked;
		}); 
	}
	
</script>